<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

<body>
	<ui:composition template="/template/template.xhtml">
		<ui:define name="body">										
			<h:form onkeypress="if (event.keyCode == 13) return false;">
								
				<rich:notifyMessages stayTime="5000" nonblocking="true" />														              			
				
				<rich:extendedDataTable id="dataTable" width="100%" rows="15" frozenColumns="3"
					value="#{errorMachineBean.errorDetails}" var="errorDetail" iterationStatusVar="it">
					
					<f:facet name="header">
		                <h:outputText value="#{msg.error_machine_report}" />
		                
		            </f:facet>
					
					<rich:column width="33px">
						<f:facet name="header">
			                <h:outputText value="#{msg.index_logo}" />
			            </f:facet>						 
						<h:outputText value="#{it.index + 1}" />						
					</rich:column>
					
					<rich:column width="115px"
						sortBy="#{errorDetail.readMachineData.nid}"
						sortOrder="#{errorMachineBean.sortsOrders['errorDetail_nid']}">
						
						<f:facet name="header">			                
			                <h:panelGrid columns="2">
								<a4j:commandLink style="color:#FFFFFF" styleClass="tableTitle"
									value="#{msg.nid}" render="@form"
									action="#{errorMachineBean.sort}" execute="@this" immediate="true" > 									
									<f:param name="sortProperty" value="errorDetail_nid" />							
								</a4j:commandLink>

								<h:graphicImage library="images" name="icons/down_icon.gif"
									rendered="#{errorMachineBean.sortsOrders['errorDetail_nid']=='descending'}" />

								<h:graphicImage library="images"
									name="icons/up_icon.gif.gif"
									rendered="#{errorMachineBean.sortsOrders['errorDetail_nid']=='ascending'}" />

							</h:panelGrid>
			            </f:facet>		
						<h:outputText value="#{errorDetail.readMachineData.nid}" />
					</rich:column>	
					
					<rich:column width="220px"
						sortBy="#{errorDetail.realTimeControl.errorMessage}"
						sortOrder="#{errorMachineBean.sortsOrders['errorDetail_message']}">
						
						<f:facet name="header">			                
			                <h:panelGrid columns="2">
								<a4j:commandLink style="color:#FFFFFF" styleClass="tableTitle"
									value="#{msg.error_message}" render="@form"
									action="#{errorMachineBean.sort}" execute="@this" immediate="true" > 									
									<f:param name="sortProperty" value="errorDetail_message" />							
								</a4j:commandLink>

								<h:graphicImage library="images" name="icons/down_icon.gif"
									rendered="#{errorMachineBean.sortsOrders['errorDetail_message']=='descending'}" />

								<h:graphicImage library="images"
									name="icons/up_icon.gif.gif"
									rendered="#{errorMachineBean.sortsOrders['errorDetail_message']=='ascending'}" />

							</h:panelGrid>
			            </f:facet>								
						<h:outputText value="#{msg.error_message_disconnected}" rendered="#{errorDetail.realTimeControl.errorMessage == 3}"/>
						<h:outputText value="" rendered="#{errorDetail.realTimeControl.errorMessage != 3}"/>
					</rich:column>	
					
					<rich:column width="220px"
						sortBy="#{errorDetail.realTimeControl.machine.room.floor.building.buildingName}"
						sortOrder="#{errorMachineBean.sortsOrders['machine_buildingname']}">
						
						<f:facet name="header">			                
			                <h:panelGrid columns="2">
								<a4j:commandLink style="color:#FFFFFF" styleClass="tableTitle"
									value="#{msg.building_name}" render="@form"
									action="#{errorMachineBean.sort}" execute="@this" immediate="true" > 									
									<f:param name="sortProperty" value="machine_buildingname" />							
								</a4j:commandLink>

								<h:graphicImage library="images" name="icons/down_icon.gif"
									rendered="#{errorMachineBean.sortsOrders['machine_buildingname']=='descending'}" />

								<h:graphicImage library="images"
									name="icons/up_icon.gif.gif"
									rendered="#{errorMachineBean.sortsOrders['machine_buildingname']=='ascending'}" />

							</h:panelGrid>
			            </f:facet>		
						<h:outputText value="#{errorDetail.realTimeControl.machine.room.floor.building.buildingName}" />
					</rich:column>			
					
					<rich:column width="220px"
						sortBy="#{errorDetail.realTimeControl.machine.room.floor.floorName}"
						sortOrder="#{errorMachineBean.sortsOrders['machine_floorname']}">
						
						<f:facet name="header">			                
			                <h:panelGrid columns="2">
								<a4j:commandLink style="color:#FFFFFF" styleClass="tableTitle"
									value="#{msg.floor_name}" render="@form"
									action="#{errorMachineBean.sort}" execute="@this" immediate="true" > 									
									<f:param name="sortProperty" value="machine_floorname" />							
								</a4j:commandLink>

								<h:graphicImage library="images" name="icons/down_icon.gif"
									rendered="#{errorMachineBean.sortsOrders['machine_floorname']=='descending'}" />

								<h:graphicImage library="images"
									name="icons/up_icon.gif.gif"
									rendered="#{errorMachineBean.sortsOrders['machine_floorname']=='ascending'}" />

							</h:panelGrid>
			            </f:facet>		
						<h:outputText value="#{errorDetail.realTimeControl.machine.room.floor.floorName}" />
					</rich:column>	
					
					<rich:column width="220px"
						sortBy="#{errorDetail.realTimeControl.machine.room.roomName}"
						sortOrder="#{errorMachineBean.sortsOrders['machine_roomname']}">
						
						<f:facet name="header">			                
			                <h:panelGrid columns="2">
								<a4j:commandLink style="color:#FFFFFF" styleClass="tableTitle"
									value="#{msg.room_name}" render="@form"
									action="#{errorMachineBean.sort}" execute="@this" immediate="true" > 									
									<f:param name="sortProperty" value="machine_roomname" />							
								</a4j:commandLink>

								<h:graphicImage library="images" name="icons/down_icon.gif"
									rendered="#{errorMachineBean.sortsOrders['machine_roomname']=='descending'}" />

								<h:graphicImage library="images"
									name="icons/up_icon.gif.gif"
									rendered="#{errorMachineBean.sortsOrders['machine_roomname']=='ascending'}" />

							</h:panelGrid>
			            </f:facet>		
						<h:outputText value="#{errorDetail.realTimeControl.machine.room.roomName}" />
					</rich:column>	
					
					<rich:column width="220px"
						sortBy="#{errorDetail.realTimeControl.machine.machineName}"
						sortOrder="#{errorMachineBean.sortsOrders['machine_machinename']}">
						
						<f:facet name="header">			                
			                <h:panelGrid columns="2">
								<a4j:commandLink style="color:#FFFFFF" styleClass="tableTitle"
									value="#{msg.machine_name}" render="@form"
									action="#{errorMachineBean.sort}" execute="@this" immediate="true" > 									
									<f:param name="sortProperty" value="machine_machinename" />							
								</a4j:commandLink>

								<h:graphicImage library="images" name="icons/down_icon.gif"
									rendered="#{errorMachineBean.sortsOrders['machine_machinename']=='descending'}" />

								<h:graphicImage library="images"
									name="icons/up_icon.gif.gif"
									rendered="#{errorMachineBean.sortsOrders['machine_machinename']=='ascending'}" />

							</h:panelGrid>
			            </f:facet>		
						<h:outputText value="#{errorDetail.realTimeControl.machine.machineName}" />
					</rich:column>																		
	
		            
		            <f:facet name="footer">
		            	<h:commandButton styleClass="buttonClass" style="font-size: 16px;" 
							value="#{msg.excel}" 
							actionListener="#{errorMachineBean.genExcel}" 
							rendered="#{not empty errorMachineBean.errorDetails}" />
						<h:outputText value="&#160;" /> 
						<h:outputText value="&#160;" /> 
						<h:outputText value="&#160;" />
		                <rich:dataScroller page="#{errorMachineBean.page}" />
		                
		              
		            </f:facet>
					
				</rich:extendedDataTable>
				
				
					
			</h:form>						
			    
		</ui:define>
	</ui:composition>
</body>
</html>
